package edu.zju.gis.dldsj.service;

import edu.zju.gis.dldsj.entity.*;

import java.util.Date;
import java.util.List;

/**
 * 针对dldsj项目工作流业务部分的服务接口
 *
 * @author yanlong_lee@qq.com
 * @version 1.0 2018/11/06
 */
public interface WfService {
    int insert(AirflowDag airflowDag);

    int insert(WfDag wfDag);

    void insert(AirflowDag airflowDag, WfDag wfDag);

    void update(WfDag wfDag);

    void deleteWfDag(String dagId);

    int insert(WfRun dagRun);

    void update(WfRun dagRun);

    void deleteWfRun(int id);

    int insert(WfInstance instance);

    void update(WfInstance instance);

    void deleteWfInstance(String dagId, Date executionDate);

    void deleteWfInstance(String dagId, Date executionDate, String taskId);

    int getDagCount();

    AirflowDag getDag(String dagId);

    List<AirflowDag> getDag(int offset, int size);

    List<AirflowDagStats> getDagStats(String dagId);

    AirflowDagStats getDagStats(String dagId, DagState state);

    List<AirflowDagRun> getDagRun(String dagId);

    List<AirflowDagRun> getDagRun(DagState state);

    AirflowDagRun getDagRun(int id);

    AirflowTaskInstance getTaskInstance(String dagId, String taskId, Date executionDate);

    List<AirflowTaskInstance> getTaskInstance(String dagId, Date executionDate);

    List<AirflowTaskFail> getTaskFail(String dagId, Date executionDate);

    WfDag getWfDag(String dagId);

    List<WfDag> getWfDag(String userId, int offset, int size);

    WfRun getWfRun(int id);

    List<WfRun> getWfRun(String dagId);

    List<WfRun> getWfRun(DagTaskState state);

    List<WfRun> getWfRun(String dagId, DagTaskState state);

    List<WfInstance> getWfInstance(String dagId, Date executionDate);

    WfInstance getWfInstance(String dagId, Date executionDate, String taskId);

}
